
  function previewImage(file)
    {
      var MAXWIDTH  = 90; 
      var MAXHEIGHT = 90;
      var div = document.getElementById('preview');
      if (file.files && file.files[0])
      {
          div.innerHTML ='<img id=imghead onclick=$("#previewImg").click()>';
          var img = document.getElementById('imghead');
          img.onload = function(){
            var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
            img.width  =  rect.width;
            img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
            img.style.marginTop = rect.top+'px';
            var h = $('#imghead').attr('src');
          console.log(h);
          }
          var reader = new FileReader();
          reader.onload = function(evt){img.src = evt.target.result;}
          reader.readAsDataURL(file.files[0]);
          
      }
      else //兼容IE
      {
        var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
        file.select();
        var src = document.selection.createRange().text;
        div.innerHTML = '<img id=imghead>';
        var img = document.getElementById('imghead');
        img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
        var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
        status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
        div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
      }

    }
    function clacImgZoomParam( maxWidth, maxHeight, width, height ){
        var param = {top:-20, left:0, width:width, height:height};
        if( width>maxWidth || height>maxHeight ){
            rateWidth = width / maxWidth;
            rateHeight = height / maxHeight;
            
            if( rateWidth > rateHeight ){
                param.width =  maxWidth;
                param.height = Math.round(height / rateWidth);
            }else{
                param.width = Math.round(width / rateHeight);
                param.height = maxHeight;
            }
        }
        param.left = Math.round((maxWidth - param.width) / 2);
        param.top = Math.round((maxHeight - param.height) / 2);
        return param;

    }








    function previewImage1(file)
    {
      var MAXWIDTH  = 90; 
      var MAXHEIGHT = 90;
      var div = document.getElementById('preview1');
      if (file.files && file.files[0])
      {
          div.innerHTML ='<img id=imghead1 onclick=$("#previewImg1").click()>';
          var img = document.getElementById('imghead1');
          img.onload = function(){
            var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
            img.width  =  rect.width;
            img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
            img.style.marginTop = rect.top+'px';
          }
          var reader = new FileReader();
          reader.onload = function(evt){img.src = evt.target.result;}
          reader.readAsDataURL(file.files[0]);
      }
      else //兼容IE
      {
        var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
        file.select();
        var src = document.selection.createRange().text;
        div.innerHTML = '<img id=imghead1>';
        var img = document.getElementById('imghead1');
        img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
        var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
        status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
        div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
      }
    }
    function clacImgZoomParam( maxWidth, maxHeight, width, height ){
        var param = {top:-20, left:0, width:width, height:height};
        if( width>maxWidth || height>maxHeight ){
            rateWidth = width / maxWidth;
            rateHeight = height / maxHeight;
            
            if( rateWidth > rateHeight ){
                param.width =  maxWidth;
                param.height = Math.round(height / rateWidth);
            }else{
                param.width = Math.round(width / rateHeight);
                param.height = maxHeight;
            }
        }
        param.left = Math.round((maxWidth - param.width) / 2);
        param.top = Math.round((maxHeight - param.height) / 2);
        return param;
    }



var custom_num=0;
function custom_huantu(ele){
    var tupian1 = $(ele).attr("src");
    var newSrc = tupian1 === './gerenxinxi_img/组-@2x.png'?'./gerenxinxi_img/组-1@2x.png':'./gerenxinxi_img/组-@2x.png';
    $(ele).attr("src",newSrc);
}
/*function custom_huantu2(ele){
    var tupian1 = $(ele).attr("src");
    $(".shenfen span img").each(function(index,item){
        $(item).attr("src","gerenxinxi_img/组-2@2x.png");
    });
    var newSrc = tupian1 === 'gerenxinxi_img/组-2@2x.png'?'./gerenxinxi_img/图层-@2x.png':'./gerenxinxi_img/组-2@2x.png';
    $(ele).attr("src",newSrc);
}*/
/*死函数*/
/*运费估算*/
/*$(".shenfen span img").each(function(index,item){
    
    $(item).click(function(){
        custom_huantu2(this);
        console.log(index);
    });
});*/
$('.dxk1').click(function(){
  console.log($('.dxk1').val());
})
$('.dxk2').click(function(){
  console.log($('.dxk2').val());
})
$('.data span img').click(function(){
    custom_huantu(this);
    custom_num=custom_num===0?1:0;
})


$('.xiugai1').click(function(){
   
   $('.xingmin-ipt input').val('');
   $('.xingmin-ipt input').removeAttr('disabled');
    
     $('.xingmin-ipt input').focus(function(){
        if($('.xingmin-ipt input').val().length>1){
            console.log('dasf');
            $('.xingmin-ipt input').attr('disabled','true');
        }
     })
})
$('.tianxie1').click(function(){
    $('.sfz-ipt input').val('');
    $('.sfz-ipt input').removeAttr('disabled');
    $('.sfz-ipt input').focus(function(){
        if($('.sfz-ipt input').val().length>=18){
            var sfzh = $('.sfz-ipt input').val().substring(0,6);
            var sfzh1 = $('.sfz-ipt input').val().substring(14,18);
            console.log(sfzh1);
            console.log(sfzh);
            var sfzh2 = sfzh+'********'+sfzh1;
            $('.sfz-ipt input').val(sfzh2);
            $('.sfz-ipt input').attr('disabled','true');
        }

    })
})
var dizhi = $('.xm span i').html();
if(dizhi.length>=9){
    var dizhi1 = $('.xm span i').html().substring(0,9);
    var dizhi2 = dizhi1+'…';
    $('.xm span i').html(dizhi2);

}
